<?php
// --------------------------------------------------------------------
// graphics.php
// Graphics class to manage the layout for a website.
// Tommy Harvey
// 2011-04-02   
// --------------------------------------------------------------------

    class Table {
        var $iCount;
        var $sTable = '';
        var $className;
        
        function Table( $class ){
            $this->className = $class;
            $this->CreateTable();
        }
        
        function CreateTable(){
            echo '<table class='.$this->className.' >';
        }
        
        function NewLine($class=''){
            echo '<tr class='.$class.'>';
            $this->iCount++;
        }
        
        function NewCol($class=NULL, $func=NULL, $funcParams=NULL, $colspan=1){
            echo '<td class='.$class.' colspan='.$colspan.'>';
            if ($func!=NULL)
            {
                echo $func($funcParams);
            }           
        }
        
        function Hyperlink($class=NULL, $string, $url){
            echo '<a href="'.$url.'" class='.$class.'>'.$string.'</a>';
        }
        
        function CloseLine(){
            echo '</tr>';
        }
        
        function CloseCol(){
            echo '</td>';
        }
        
        function CloseDiv(){
            echo '</div>';
        }
        
        function CloseTable(){
            echo '</table>';
        }
        
        function PrintTable(){
            return $this->sTable;
        }
        
        function Write($string, $func=NULL, $funcParams=NULL){
            if ($string != NULL) {echo $string;}
            if ($func!=NULL)
            {
                eval ($func);
            }
        }

        function NewImage($pic, $class){
            echo '<img src='.$pic.' class='.$class.'></img>';
        }
        
        function Header($string, $weitgh){
            echo '<h'.$weight.'>'.$string.'<h'.$weight.'/>';
        }
       
        function GetRecords(){
            return $iCount;
        }
    }

?>
